(function(undefined){
	
	var selected_obj = {};
	
	//数据
	selected_obj.data = {
		name: '',			//input name
		divcls: '',			//div class
		width: '',			//宽度px
		def: {
			text: '',		//span html
			value: ''		//input def value
		},		
		rows: [{			//数据集
			text: '',		//文本
			value: ''		//值
		}],
		own: ''				//依赖对象
	};		

	/**
	 * 创建下拉列表
	 * @param {Object} param
	 */
	selected_obj.create = function(param) {				
		
		//生成hidden						
		var input_hide = $('<input>');
		input_hide.attr('type', 'hidden');
		input_hide.attr('name', param.name);
		input_hide.val(param.def.value);

		//生成DIV
		var main_div = $('<div></div>');		
		main_div.attr('class', param.divcls);
		main_div.css('width', param.width);
		main_div.html('<p style="cursor:pointer;">' + param.def.text + '</p><span></span>');
		
		//生成数据列表
		var ul_div = $('<ul></ul>');
		ul_div.hide();
		for(var i in param.rows) {
			var li_obj = $('<li></li>');
			li_obj.text(param.rows[i].text);
			li_obj.attr('val', param.rows[i].value);
			ul_div.append(li_obj);			
		}
		
		$(document.body).click(function(){
			ul_div.hide();
		});				
		
		ul_div.find('li').click(function(e){
			main_div.find('p').text($(this).text());
			input_hide.val($(this).attr('val'));
			ul_div.hide();
			common_fun_obj.done(e);									
		});
		
		main_div.click(function(e){					
			ul_div.show();
			if(config.browse.ie) {
				common_fun_obj.done();
			} else {
				common_fun_obj.done(e);				
			}								
		});

		//追加进入main/own
		main_div.append(ul_div);		
		param.own.append(input_hide);
		param.own.append(main_div);														
	}
	

	if(window.selected_obj == undefined) {
		window.selected_obj = selected_obj;
	}	
})();
